﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuangCaoTren.ascx.cs" Inherits="WebHousingInfo.Controls.QuangCaoTren" %>
<link rel="stylesheet" type="text/css" href="css/style_slidershow.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.easing.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
 $(document).ready( function(){	
		$('#lofslidecontent45').lofJSidernews( { interval:3000,
											 	easing:'easeInOutQuad',
												duration:1200,
												auto:true } );						
	});

</script>
<style>
	
	ul.lof-main-wapper li {
		position:relative;	
	}
</style>
<div id="lofslidecontent45" class="lof-slidecontent">
<div class="preload"><div></div></div>
 <!-- MAIN CONTENT --> 
  <div class="lof-main-outer">
  	<ul class="lof-main-wapper">
  	<% var LocalDetail = GetLocal();
      int dem = 0;
      if (LocalDetail != null)
      {
          foreach (var detai in LocalDetail)
          {
              if (detai.IsActive == true && detai.NewsHouseID != null)
              {
                  var ObNews = HousingInfo.Library.NewsHouseBO.GetNewsHouseBO(Convert.ToInt32(detai.NewsHouseID));
                  if (ObNews.IsActive == true && ObNews.ExpireDate >= DateTime.Now && ObNews.IsAdvertisement == true)
                  {
                      if (HousingInfo.Library.VipHouseBOList.KiemtraTinVip_TonTai_ConHanDang_ViTriTren(ObNews.NewsHouseID) == true)
                      {
                          dem += 1;
     %>
  		<li>
            <% if (ObNews.UrlImageAdversitement != "")
               {
                   if (checkurlimage(ObNews.UrlImageAdversitement) == true)
                   {
                       string url = "TotalUpload/ImagesTotal/" + ObNews.UrlImageAdversitement;                                                                                        
                         %><img src="<%=url %>" height="240px" width="485px" />
                         <% }
                   else
                   { %><img src="TotalUpload/ImagesTotal/noimage.gif" height="240" width="485px">   
                    <% }
               }
               else
               { %>
                   <img src="TotalUpload/ImagesTotal/noimage.gif" height="240" width="485px">
                <%} %>        
             <div class="lof-main-item-desc">
                <h3><a target="_blank" href="TinNhaDatChiTiet.aspx?id=<%=ObNews.NewsHouseID %>"><%=ObNews.Title%></a></h3>
                <p><% if (ObNews.NewsContent.Length > 200)
                      {%>
                    <%=ObNews.NewsContent.Substring(0, 199)%> ...
                <%}
                      else
                      {%>
                 <%=ObNews.NewsContent%>
                <%} %></p>
            </div>
        </li>   
    <%                  }
                     }                  
              }
          }
      }
      if(LocalDetail == null || dem < 3)
      {
          var OBNews_Null = HousingInfo.Library.NewsHouseBOList.GetFiveNewsHouse_ByOrderViewCount(3);
          foreach(var OBNews_WhenNull in OBNews_Null) { %>        
          <li>
            <% if (OBNews_WhenNull.UrlImage != "")
                {
                    var listimage = OBNews_WhenNull.UrlImage.Split('/');
                    string url = "";
                    foreach (var detail in listimage)
                    {
                        if (checkurlimage(detail) == true)
                        {
                            url = "TotalUpload/ImagesTotal/" + detail;                                    
                                    
                                
                             %><img src="<%=url %>" height="240px" width="485px" /><% break;
                        }
                    }
                    if (url == "")
                    { %><img src="TotalUpload/ImagesTotal/noimage.gif" height="240" width="485px" />
                    <% }
                }
                else
                { %>
                    <img src="TotalUpload/ImagesTotal/noimage.gif" height="240" width="485px" />
                <%} %>                      
                            
             <div class="lof-main-item-desc">
                <h3><a target="_blank" href="TinNhaDatChiTiet.aspx?id=<%=OBNews_WhenNull.NewsHouseID %>"><%=OBNews_WhenNull.Title%></a></h3>
                <p><% if (OBNews_WhenNull.NewsContent.Length > 200)
                      {%>
                    <%=OBNews_WhenNull.NewsContent.Substring(0, 199)%> ...
                <%}
                      else
                      {%>
                 <%=OBNews_WhenNull.NewsContent%>
                <%} %></p>
            </div>
        </li>       
        <!-- Neu chua co tin quang cao nao thi lay may tin moi dua len -->   
    <%} } %>
      </ul>  	
  </div>
  <!-- END MAIN CONTENT --> 
    <!-- NAVIGATOR -->

  <div class="lof-navigator-outer">
  		<ul class="lof-navigator">
  		<% if (LocalDetail != null)
       {
           foreach (var detai in LocalDetail)
           {
               if (detai.IsActive == true && detai.NewsHouseID != null)
               {
                   var ObNews_Small = HousingInfo.Library.NewsHouseBO.GetNewsHouseBO(Convert.ToInt32(detai.NewsHouseID));
                   if (ObNews_Small.IsActive == true && ObNews_Small.ExpireDate >= DateTime.Now && ObNews_Small.IsAdvertisement == true)
                   {
                       if (HousingInfo.Library.VipHouseBOList.KiemtraTinVip_TonTai_ConHanDang_ViTriTren(ObNews_Small.NewsHouseID) == true)
                       {
       %>
            <li>
            	<div>
            	    <% if (ObNews_Small.UrlImageAdversitement != "")
                    {
                        if (checkurlimage(ObNews_Small.UrlImageAdversitement) == true)
                        {
                            string url = "TotalUpload/ImagesTotal/" + ObNews_Small.UrlImageAdversitement;                                                                                        
                         %><img src="<%=url %>" />
                         <% }
                        else
                        { %><img src="TotalUpload/ImagesTotal/noimage.gif" />   
                    <% }
                    }
                    else
                    { %>
                   <img src="TotalUpload/ImagesTotal/noimage.gif" /> 
                <%} %>
                	<h3><%=ObNews_Small.Title%></h3>
                  	<span>Ngày Đăng <%=Convert.ToDateTime(ObNews_Small.PostDate).ToShortDateString()%></span>
                </div>    
            </li>
            <%          }
                   }
               }
           }
       }
       if (LocalDetail == null || dem < 3)
       {
           var OBNews_Null_Left = HousingInfo.Library.NewsHouseBOList.GetFiveNewsHouse_ByOrderViewCount(3);
           foreach (var OBNews_WhenNull_Left in OBNews_Null_Left)
           { %>    		
           <!-- Neu chua co tin quang cao nao thi lay may tin moi dua len -->   
           <li>
            	<div>
            	<% if (OBNews_WhenNull_Left.UrlImage != "")
                {
                    var listimage = OBNews_WhenNull_Left.UrlImage.Split('/');
                    string url = "";
                    foreach (var detail in listimage)
                    {
                        if (checkurlimage(detail) == true)
                        {
                            url = "TotalUpload/ImagesTotal/" + detail;                                    
                                    
                                
                             %><img src="<%=url %>" /><% break;
                        }
                    }
                    if (url == "")
                    { %><img src="TotalUpload/ImagesTotal/noimage.gif" />
                    <% }
                }
                else
                { %>
                    <img src="TotalUpload/ImagesTotal/noimage.gif" />
                <%} %>                	            	            	
            	            	   
                	<h3><%=OBNews_WhenNull_Left.Title%></h3>
                  	<span>Ngày Đăng <%=Convert.ToDateTime(OBNews_WhenNull_Left.PostDate).ToShortDateString() %></span>
                </div>    
            </li>                
        <%}
       } %>
        </ul>
  </div>
 </div>   